<script type="text/javascript">
    $(document).ready(loadCMSTable);
</script>
<div id="dt_example">
    <div id="container">
        <div id="demo"
             <div style="font-size: 15px;font-style: oblique;font-weight: bold;margin-bottom: 10px;">Privileges Table</div>
             <div style="font-size: 15px;font-style: oblique;font-weight: bold;margin-bottom: 10px;margin: 20px;">
                 <a href ="#" onclick="load_link('index.php?page=privileges&action=create',load_validation)">Create Privileges</a>
             </div>
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Basic Quantity</th>
                        <th>Used Quantity</th>
                        <th>Type</th>
                        <th>Edit</th>
                        <th>Delete</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    foreach($datas as $data){
                    echo"<tr>";
                        echo "<td>{$data->name}</td>";
                        echo "<td>{$data->basicQuantity}</td>";
                        echo "<td>{$data->usedQuantity}</td>";
                        echo "<td>{$data->type->name}</td>";
                        echo "<td><a href ='#' onclick='load_link(\"index.php?page=privileges&action=create&id={$data->id}\",load_validation)'>Edit</a></td>";
                        $status = $data->isDeleted ==0?"Delete":"Restore";
                        $cstatus = $data->isDeleted ==1?"Deleted":"Active";
                        echo "<td>{$cstatus} ( <a href ='#' onclick='load_link(\"index.php?page=privileges&action=delete&id={$data->id}&delState={$data->isDeleted}\")'> {$status}</a> )</td>";
                    echo"</tr>";
                    }
                    ?>
                </tbody>
            </table>
        </div>
    </div>
</div>